package imganalysis;

import java.util.ArrayList;

/**
 *
 * @author sheila
 */

public class Cluster {
        private int []  aiCentroidDimensionsVector;
        private int idCluster;
        private ArrayList<DataUnit> aDataUnits;// DataUnits that belong to this Cluster

        public Cluster(int [] paiCentroidDimensionsVector){
            this.aDataUnits=new ArrayList<DataUnit>();
            this.aiCentroidDimensionsVector = paiCentroidDimensionsVector;
        }

        public void removeAllDataUnits(){
            this.aDataUnits.clear();
        }

        public void setCentroidDimension(int pidimension, int pivalor){
            this.aiCentroidDimensionsVector[pidimension] = pivalor;
        }
        public DataUnit getDataUnit(int pindexDU){
            return this.aDataUnits.get(pindexDU);
        }

        public int getNumDataUnits() {
            return aDataUnits.size();
        }

        public void addDataUnit(DataUnit poDataUnit){
            this.aDataUnits.add(poDataUnit);
        }
        
        public void setId(int pidCluster) {
            this.idCluster = pidCluster;
        }

        public int[] getAiCentroidDimensionsVector() {
            return this.aiCentroidDimensionsVector;
        }


        public int getCentroidDimension(int i){
            return this.aiCentroidDimensionsVector[i];
        }
        public int getNumCentroidDimensions(){// verificar isto
            if(this.aiCentroidDimensionsVector!=null)
                return this.aiCentroidDimensionsVector.length;
            else
                return 0;
        }
        public int[] cloneAiCentroidDimensionsVector(){
            return this.aiCentroidDimensionsVector.clone();
        }
        public ArrayList<DataUnit> getaDataUnits() {
        return aDataUnits;
        }

        public void setaDataUnits(ArrayList<DataUnit> aDataUnits) {
            this.aDataUnits = aDataUnits;
        }
    }